package acm;

import java.io.PrintStream;
import java.util.Scanner;

public class FeGeNumFigure2
{
	static Scanner in;
	static PrintStream out;
	
	public static void main(String[] args)
	{
		in = new Scanner(System.in);
		out = System.out;
		
		for ( int i=in.nextInt(); i>0; i-- )
		{
			figure();
		}
	}
	
	private static void figure()
	{
		int num = in.nextInt();
		
		int end = num / 2584 + 2;
		boolean flag = false;
		
		for ( int i=0; i<end; i++ )
		{
			if( (num - 2584 * i) % 4181 == 0 )
			{
				out.println(i + " " + (num - 2584 * i) / 4181);
				flag = true;
				break;
			}
		}
		
		if ( flag == false )
		{
			out.println("No answer");
		}
	}
}
